home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
-
- # Send the output mime type to the server to know what output to handle.
-
- print "Content-type: text/html\n\n";
-
- # Print HTML header information.
-
- print <<EOH;
- <HTML>
- <HEAD><TITLE>CGI Script How-to: Test Script</TITLE></HEAD>
- <BODY>
- <H1>CGI Script How-to<BR>determine the client machine's name</H1>
- EOH
-
- # Access the environment variable by name
-
- $remote_addr = $ENV{'REMOTE_ADDR'};
-
- # Send the mime type to the server to know what output to handle.
-
- # Test and use the variable. If the value is not defined then the server
- # could not identify the client who will remain anonymous.
-
- if ($remote_addr)
- {
- print "Your Internet address is <B>$remote_addr</B>\n";
- }
- else
- {
- print "I don't know your Internet address. Who are you?\n";
- }
-
- # Print closing HTML tags.
-
- print "</BODY></HTML>\n";
-
- #
- # end of chkaddr.pl
- #
-